#! /bin/bash
export LANG=zh_CN.UTF-8
HIVE_HOME=/usr/bin/hive


${HIVE_HOME} -S -e "
create database if not exists edu_dws;
use edu_dws;


drop table if exists sq_dws_cul_day_cnt;
create table sq_dws_cul_day_cnt(
    c_day string comment '天',
    orgin_type string comment '来源渠道',
    itcast_school_id int comment '校区id',
    itcast_school_name string comment '校区名',
    itcast_subject_id int comment '学科id',
    itcast_subject_name string comment '学科名称',
    tdepart_id int comment'部门id',
    tdepart_name string comment'部门名称',
    origin_channel string comment'数据来源',
    r_num  DECIMAL(38,2),--意向人数
    s_num DECIMAL(38,2),--报名人数
    live_num DECIMAL(38,2),--有效线索人数
    r_cnt DECIMAL(38,2) comment'意向转换报名率',
    online_cnt DECIMAL(38,2) comment'线上有效线索转化率',
    group_type string
)row format delimited
fields terminated by '\t'
stored AS orc tblproperties ('orc.compress' = 'SNAPPY');"